import util from '@/lib/util'

const KEY_SCREEN_LOCK = "KEY_SCREEN_LOCK";

// 输注状态信息存储key
const KEY_FLUSION_STATUS_INFO = "KEY_FLUSION_STATUS_INFO";

export default class GlobalService{
    isScreenLocked(){
        return util.cookies.get(KEY_SCREEN_LOCK) === "false" ? false : true;
    }

    ScreenLock(){
        util.cookies.set(KEY_SCREEN_LOCK, true);
    }

    ScreenUnLock(){
        util.cookies.set(KEY_SCREEN_LOCK, false);
    }

    /**
     * 获取输注状态和信息
     */
    getFlusionInfo(){
        var flusion = util.cookies.get(KEY_FLUSION_STATUS_INFO);
        return flusion ?  JSON.parse(flusion) :  {isStoped: false, description: '基础输注中...'};
    }

    /**
     * 设置输注状态和信息
     */
    setFlusinInfo(isStoped, description, stopAt){
        util.cookies.set(KEY_FLUSION_STATUS_INFO, {isStoped: isStoped, description: description,stopAt: stopAt});
    }
}